#!/bin/sh

ROOT="$HOME/.quests"

echo "Convention: <verb> <object>"
echo "<object> may be more than one word"
echo -n "Name: "
read NAME
NAME=`echo $NAME | sed 's/ /_/g'`

echo -n "Tags: "
read TAGS
TAGS=`echo $TAGS | tr ' ' '\n'`

TARGET="$ROOT/$NAME"

echo "Saving new quest at '$TARGET'..."
mkdir -p "$TARGET"
echo $TAGS | tr ' ' '\n' >> "$TARGET"/tags

echo "Creating env script..."
echo "#!/bin/sh" >> "$TARGET"/env
chmod +x "$TARGET"/env

echo "Finished! You can start editing the env script at '$TARGET/env'"
